<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>翻转世界</title>
    <style>
      .box {
        width: 500px;
        height: 500px;
        background-color: #000;
        margin: 100px auto;
        perspective: 1000px;
      }
      .txt {
        width: 100%;
        color: #fff;
        font-size: 30px;
      }
    </style>
  </head>
  <body>
    <script src="../vue.js"></script>
    <div class="box">
      <p class="txt">{{msg}}</p>
      <button class="btn" @click="change">翻转世界</button>
    </div>
    <script>
      const app = new Vue({
        el: ".box",
        data: {
          trun: false,
          msg: "Hello, Wrold",
        },
        methods: {
          change() {
            this.trun = !this.trun;
            if (this.trun) {
              this.msg = "dlorW ,olleH";
            } else {
              this.msg = "Hello, Wrold";
            }
          },
        },
      });
    </script>
  </body>
</html>
